<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/oauthplatform/static/css/x-admin/font.css">
    <link rel="stylesheet" href="/oauthplatform/static/css/x-admin/xadmin.css">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="dataForm">
            <input type="hidden" name="id" value="${(userInfo.id?c)!}">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" name="userName" value="${userInfo.userName}" class="layui-input" readonly>
                </div>
                <div class="layui-form-mid layui-word-aux">不可修改</div>
            </div>


            <#if userInfo.source != 3>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" placeholder="默认密码：hnzy1234" class="layui-input" autocomplete="off" >
                    </div>
                </div>
            </#if>


<#--            <div class="layui-form-item">-->
<#--                <label class="layui-form-label">是否启用</label>-->
<#--                <div class="layui-input-inline">-->
<#--                    <select name="isValid" lay-verify="required" required>-->
<#--                        <option value="1" <#if userInfo.isValid == 1>selected</#if>>是</option>-->
<#--                        <option value="0" <#if userInfo.isValid == 0>selected</#if>>否</option>-->
<#--                    </select>-->
<#--                </div>-->
<#--            </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label">系统昵称</label>
                <div class="layui-col-md4 layui-input-inline">
                    <input type="text" name="nickName" value="${userInfo.nickName!''}" class="layui-input" maxlength="10" required lay-verify="required" autocomplete="off" placeholder="请输入角色名称" >
                </div>
                <div class="layui-form-mid layui-word-aux">必填</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">真实姓名</label>
                <div class="layui-col-md4 layui-input-inline">
                    <input type="text" name="name" class="layui-input" value="${userInfo.name!''}" maxlength="10" required lay-verify="required" autocomplete="off" placeholder="请输入角色名称" >
                </div>
                <div class="layui-form-mid layui-word-aux">必填</div>
            </div>


<#--            <div class="layui-form-item">-->
<#--                <label class="layui-form-label">性别</label>-->
<#--                <div class="layui-input-inline">-->
<#--                    <select name="isValid">-->
<#--                        <option value="3">其他</option>-->
<#--                        <option value="1">男</option>-->
<#--                        <option value="2">女</option>-->
<#--                    </select>-->
<#--                </div>-->
<#--            </div>-->

<#--            <div class="layui-form-item">-->
<#--                <label class="layui-form-label">出生日期</label>-->
<#--                <div class="layui-input-inline">-->
<#--                    <input readonly name="birthdayStr" id="birthdayStr" class="layui-input">-->
<#--                </div>-->
<#--            </div>-->

<#--            <div class="layui-form-item">-->
<#--                <label class="layui-form-label">身份证号码</label>-->
<#--                <div class="layui-input-inline">-->
<#--                    <input type="text" name="idCard" class="layui-input">-->
<#--                </div>-->
<#--            </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label">联系方式</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" value="${userInfo.phone!''}" class="layui-input" maxlength="15">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">所属地市</label>
                <div class="layui-input-inline">
                    <select name="areaId" lay-search lay-verify="required" required>
                        <option value="">请选择</option>
                        <#list areaList as al>
                            <option value="${al.areaId}" <#if al.areaId == userInfo.areaId>selected</#if>>${al.areaName}</option>
                        </#list>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux">必选</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-col-md6">
                    <input type="text" name="address" value="${userInfo.address!''}"  class="layui-input">
                </div>
            </div>

            <#if userInfo.deptId ??>
                <div class="layui-form-item">
                    <label class="layui-form-label">所属机构</label>
                    <div class="layui-col-md6">
                        <select name="deptId" lay-search required lay-verify="required">
                            <option value="">请选择</option>
                            <#list deptList as dl>
                                <option value="${(dl.id?c)!}" <#if dl.id == userInfo.deptId>selected</#if>>${dl.deptName}</option>
                            </#list>
                        </select>
                    </div>
                    <div class="layui-form-mid layui-word-aux">必选</div>
                </div>
            </#if>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="/oauthplatform/static/lib/layui/layui.all.js" charset="utf-8"></script>
<script type="text/javascript" src="/oauthplatform/static/lib/jquery/jquery.3.4.1.js"></script>
<script type="text/javascript" src="/oauthplatform/static/lib/x-admin/xadmin.js"></script>
<script src="/oauthplatform/static/lib/other/html5.min.js"></script>
<script src="/oauthplatform/static/lib/other/respond.min.js"></script>
<script type="application/javascript">
    layui.use(['form','laydate'], function(){

        var form = layui.form;


        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                type: "POST",//方法类型
                url: "/oauthplatform/user/update" ,//url
                data: $('#dataForm').serialize(),
                success: function (result) {
                    layer.msg(result.msg);
                    if(parseInt(result.code)==200){
                        setTimeout(function(){
                            xadmin.close();
                            xadmin.father_reload();
                        }, 2000);
                    }


                },
                error: function (result) {
                    layer.msg("系统异常,请联系管理员");
                }
            });
            return false;
        });





    });
</script>
</body>
</html>